<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName"
           value="${message(code: 'workflowStage.label', default: 'WorkflowStage')}"/>
    <title>新增区域-工作流</title>
</head>

<body>
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li>
                        <g:link controller="workflow" action="index">工作流</g:link>
                    </li>
                    <li class="active">
                        <span>新增工作流</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                新增工作流
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">
    <div class="row">
        <div class="hpanel hblue">
            <div class="panel-heading">
                新增工作流
            </div>

            <div class="panel-body">
                <g:form action="save" class="form-horizontal">
                    <g:if test="${flash.message}">
                        <div class="message" role="status">${flash.message}</div>
                    </g:if>
                    <g:hasErrors bean="${this.workflowStage}">
                        <ul class="errors" role="alert">
                            <g:eachError bean="${this.workflowStage}" var="error">
                                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
                                        error="${error}"/></li>
                            </g:eachError>
                        </ul>
                    </g:hasErrors>

                    <g:textField class="form-control hidden" type="text" name="targetUri" id="targetUri" value="${params.targetUri}"/>

                    <div class="form-group">
                        <g:textField name="workflow.id" required="required" id="workflow" value="${this.workflowStage?.workflow?.id}" class="hide"/>
                        <label class="col-md-2 control-label">订单阶段</label>
                        <div class="col-md-3">
                            <g:textField name="name"
                                         value="${this.workflowStage?.name}"
                                         class="form-control" placeholder="请输入订单阶段"/>
                        </div>
                        %{--<label class="col-md-2 control-label">订单阶段</label>--}%
                        %{--<div class="col-md-3">--}%
                            %{--<g:select class="form-control" name="stage.id" required="required" id="stage"--}%
                                      %{--value="${this.workflowStage?.stage}"--}%
                                      %{--from="${com.cindata.FlowStage.findAllByType(com.cindata.Workflow.findAllById(params.workflow)?.type)}"--}%
                                      %{--optionKey="id" optionValue="name"></g:select>--}%
                        %{--</div>--}%
                        <label class="col-md-2 control-label">执行次序</label>

                        <div class="col-md-3">
                            <g:textField name="executionSequence"
                                         value="${this.workflowStage?.executionSequence}"
                                         class="form-control"/>
                        </div>
                    </div>

                    <div class="hr-line-dashed"></div>

                    <div class="form-group">

                        <label class="col-md-2 control-label">能否退回</label>

                        <div class="col-md-3">
                            <div class="radio radio-info radio-inline">
                                <input type="radio" name="canReject" value="true" checked="">
                                <label for="radio1">true</label>
                            </div>

                            <div class="radio radio-info radio-inline">
                                <input type="radio" name="canReject" value="false">
                                <label for="radio2">false</label>
                            </div>
                        </div>
                        <label class="col-md-2 control-label">布局</label>

                        <div class="col-md-3">
                            <g:select class="form-control" name="layout.id"
                                      value="${this.workflowStage?.layout?.id}"
                                      required="required" id="layout"
                                      from="${com.cindata.Layout.findAllByActive(true)}" optionKey="id"
                                      optionValue="description" noSelection="${['null': '请选择']}"></g:select>

                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-3 col-md-offset-3">
                            <g:submitButton class="btn btn-info" id="btn" name="update" value="保存"/>
                        </div>
                    </div>
                </g:form>
            </div>
        </div>
    </div>
</div>

</body>
</html>
